/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 晓星航
 * Date: 2022-10-23
 * Time: 19:35
 */
class Person {

    private String name;//实例成员变量
    private int age;
    private String sex;
    //默认构造函数 构造对象
    public Person() {
        this.name = "caocao";
        this.age = 10;
        this.sex = "男";
        }
//带有3个参数的构造函数  注意这里时public 不是private
public Person(String name,int age,String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        }
public void show(){
        System.out.println("name: "+name+" age: "+age+" sex: "+sex);
        }
        }
public class TestDemo {
    public static void main(String[] args) {
        Person p1 = new Person("zhangsan",80,"男");
        p1.show();
    }
}
